package coreservlets;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class UserIDs extends HttpServlet {

	private static final long serialVersionUID = 1L;

	private int nextID = 0;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		resp.setContentType("text/html");
		PrintWriter out = resp.getWriter();
		String title = "Your ID";
		out.println(ServletUtilities.headWithTitle(title) + "<CENTER>\n"
				+ "<BODY BGCOLOR=\"#FDF5E6\">\n" + "<H1>" + title + "</H1>\n");
		String id = "User-ID-" + nextID;
		out.println("<H2>" + id + "</H2>");
		nextID = nextID + 1;
		out.println("</BODY></HTML>");
	}

}
